precision mediump float;
uniform sampler2D u_texture;

varying vec2 v_uv;

void main()
{
	//vec4 ColorBuffer = texture2D(u_texture, v_uv);
	
	//gl_FragColor =  ColorBuffer;
	
	vec2 samples0,samples1,samples2,samples3,samples4,samples5,samples6,samples7;
	vec2 sob;
	float pixelSize = 0.0005;
	float threshold = 0.001;
	samples0 = v_uv + pixelSize *vec2( -1.0, -1.0);
	samples1 = v_uv + pixelSize *vec2( 0.0, -1.0);
	samples2 = v_uv + pixelSize *vec2( 1.0, -1.0);
	samples3 = v_uv + pixelSize *vec2( 1.0, 0.0);
	samples4 = v_uv + pixelSize *vec2( 1.0, 1.0);
	samples5 = v_uv + pixelSize *vec2( 0.0, 1.0);
	samples6 = v_uv + pixelSize *vec2( -1.0, 1.0);
	samples7 = v_uv + pixelSize *vec2( -1.0, 0.0);
	sob.x = -length(texture2D(u_texture,samples0));
	sob.x += length(texture2D(u_texture,samples2));
	sob.x += 2.0 *length(texture2D(u_texture,samples3));
	sob.x += length(texture2D(u_texture,samples4));
	sob.x += - length(texture2D(u_texture,samples6));
	sob.x += -2.0 * length(texture2D(u_texture,samples7));
	sob.y = - length(texture2D(u_texture,samples0));
	sob.y += -2.0 * length(texture2D(u_texture,samples1));
	sob.y += - length(texture2D(u_texture,samples2));
	sob.y += length(texture2D(u_texture,samples4));
	sob.y += length(texture2D(u_texture,samples5));
	sob.y += 2.0 *length(texture2D(u_texture,samples7));
	gl_FragColor = vec4(max(length(sob)-threshold,0.0)*vec3(1.0,1.0,1.0),1.0);
	
}
